//package com.alibaba.csp.sentinel.dashboard.config;
//
//import com.baomidou.mybatisplus.core.MybatisConfiguration;
//import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
//import com.zaxxer.hikari.HikariDataSource;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.jdbc.DataSourceBuilder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.core.JdbcTemplate;
//
//import javax.sql.DataSource;
//
///**
// * @Description Tdengine数据源接入配置
// * @Author huangjd
// * @Since 2024/12/2 17:21
// */
//@Configuration
//@MapperScan(
//        basePackages = "com.alibaba.csp.sentinel.dashboard.repository.tdengine",
//        sqlSessionTemplateRef = "tdengineSqlSessionTemplate"
//)
//public class TdengineDataSourceConfig {
//    @Autowired
//    private MybatisConfiguration configuration;
//
//
//    @Bean("tdengineDataSource")
//    @ConfigurationProperties("spring.tdengine")
//    public DataSource tDengineDataSource(){
//        return DataSourceBuilder.create().type(HikariDataSource.class).build();
//    }
//
//    @Bean(value = "tdengineSqlSessionFactory")
//    public SqlSessionFactory tdengineSqlSessionFactory() throws Exception {
//        MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
//        bean.setDataSource(tDengineDataSource());
//        bean.setConfiguration(configuration);
//        bean.setTypeHandlersPackage("com.alibaba.csp.sentinel.dashboard.util");
//        bean.setTypeAliasesPackage("com.alibaba.csp.sentinel.dashboard.datasource.entity");
//        bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/*.xml"));
//        return bean.getObject();
//    }
//
//    @Bean("tdengineSqlSessionTemplate")
//    public SqlSessionTemplate tdengineSqlSessionTemplate(@Qualifier("tdengineSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
//        return new SqlSessionTemplate(sqlSessionFactory);
//    }
//
//    @Bean
//    public JdbcTemplate jdbcTemplate() {
//        return new JdbcTemplate(tDengineDataSource());
//    }
//    @Bean
//    public MybatisConfiguration mybatisConfiguration() {
//        MybatisConfiguration configuration = new MybatisConfiguration();
//        return configuration;
//    }
//
//}
